package com.itheima.reggie.config;

import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


@Configuration
public class MybatisPlusConfig {
    //配置分页拦截器
    @Bean
    public MybatisPlusInterceptor mpi(){
        
        //1. 创建mybatisplus拦截器
        MybatisPlusInterceptor mpi = new MybatisPlusInterceptor();
        
        //2. 添加分页的拦截功能
        mpi.addInnerInterceptor(new PaginationInnerInterceptor());
        
        //3. 返回拦截器
        return mpi;
    }
}
